package com.dyjch.mly.controller;


import com.dyjch.mly.entity.GoodsBound;
import com.dyjch.mly.service.imp.GoodsManagerServiceImp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class GoodsManagerController {

    @Autowired
    GoodsManagerServiceImp goodsManagerService;

    @RequestMapping("/inventory.html")
    public String list(Model model){
        List<GoodsBound> goods = goodsManagerService.getAllMessage();
        model.addAttribute("mess",goods);
        return "inventory";
    }

    @PostMapping("/queryByName")
    public String mesShow(String name,Model model){
        GoodsBound goodsBound = goodsManagerService.queryGoodsByName(name);
        model.addAttribute("queryMes",goodsBound);
        return "query";
    }

}
